home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / network / daemons / dns / bind-4.9 / bind-4 / usr / man / man3 / resolver.3 < prev   
Encoding:
Text File  |  1995-08-04  |  10.5 KB  |  265 lines

  1.  
  2.  
  3.  
  4. RESOLVER(3)                                           RESOLVER(3)
  5.  
  6.  
  7. NNAAMMEE
  8.        res_query,  res_search,  res_mkquery,  res_send, res_init,
  9.        dn_comp, dn_expand - resolver routines
  10.  
  11. SSYYNNOOPPSSIISS
  12.        ##iinncclluuddee <<ssyyss//ttyyppeess..hh>>
  13.        ##iinncclluuddee <<nneettiinneett//iinn..hh>>
  14.        ##iinncclluuddee <<aarrppaa//nnaammeesseerr..hh>>
  15.        ##iinncclluuddee <<rreessoollvv..hh>>
  16.  
  17.        rreess__qquueerryy((ddnnaammee,, ccllaassss,, ttyyppee,, aannsswweerr,, aannsslleenn))
  18.        cchhaarr **ddnnaammee;;
  19.        iinntt ccllaassss,, ttyyppee;;
  20.        uu__cchhaarr **aannsswweerr;;
  21.        iinntt aannsslleenn;;
  22.  
  23.        rreess__sseeaarrcchh((ddnnaammee,, ccllaassss,, ttyyppee,, aannsswweerr,, aannsslleenn))
  24.        cchhaarr **ddnnaammee;;
  25.        iinntt ccllaassss,, ttyyppee;;
  26.        uu__cchhaarr **aannsswweerr;;
  27.        iinntt aannsslleenn;;
  28.  
  29.        rreess__mmkkqquueerryy((oopp,, ddnnaammee,, ccllaassss,, ttyyppee,, ddaattaa,, ddaattaalleenn,,  nneewwrrrr,,
  30.        bbuuff,, bbuufflleenn))
  31.        iinntt oopp;;
  32.        cchhaarr **ddnnaammee;;
  33.        iinntt ccllaassss,, ttyyppee;;
  34.        cchhaarr **ddaattaa;;
  35.        iinntt ddaattaalleenn;;
  36.        ssttrruucctt rrrreecc **nneewwrrrr;;
  37.        cchhaarr **bbuuff;;
  38.        iinntt bbuufflleenn;;
  39.  
  40.        rreess__sseenndd((mmssgg,, mmssgglleenn,, aannsswweerr,, aannsslleenn))
  41.        cchhaarr **mmssgg;;
  42.        iinntt mmssgglleenn;;
  43.        cchhaarr **aannsswweerr;;
  44.        iinntt aannsslleenn;;
  45.  
  46.        rreess__iinniitt(())
  47.  
  48.        ddnn__ccoommpp((eexxpp__ddnn,, ccoommpp__ddnn,, lleennggtthh,, ddnnppttrrss,, llaassttddnnppttrr))
  49.        cchhaarr **eexxpp__ddnn,, **ccoommpp__ddnn;;
  50.        iinntt lleennggtthh;;
  51.        cchhaarr ****ddnnppttrrss,, ****llaassttddnnppttrr;;
  52.  
  53.        ddnn__eexxppaanndd((mmssgg,, eeoommoorriigg,, ccoommpp__ddnn,, eexxpp__ddnn,, lleennggtthh))
  54.        cchhaarr **mmssgg,, **eeoommoorriigg,, **ccoommpp__ddnn,, **eexxpp__ddnn;;
  55.        iinntt lleennggtthh;;
  56.  
  57. DDEESSCCRRIIPPTTIIOONN
  58.        These routines are used for making, sending and interpret-
  59.        ing query and reply messages  with  Internet  domain  name
  60.        servers.
  61.  
  62.  
  63.  
  64.                         November 11, 1993                       1
  65.  
  66.  
  67.  
  68.  
  69.  
  70. RESOLVER(3)                                           RESOLVER(3)
  71.  
  72.  
  73.        Global configuration and state information that is used by
  74.        the resolver routines is kept in the structure ___r_e_s.  Most
  75.        of the values have reasonable defaults and can be ignored.
  76.        Options stored in ___r_e_s_._o_p_t_i_o_n_s are defined in _r_e_s_o_l_v_._h and
  77.        are  as  follows.  Options are stored as a simple bit mask
  78.        containing the bitwise ``or'' of the options enabled.
  79.  
  80.        RES_INIT
  81.               True if the initial name server address and default
  82.               domain  name  are  initialized  (i.e., _r_e_s___i_n_i_t has
  83.               been called).
  84.  
  85.        RES_DEBUG
  86.               Print debugging messages.
  87.  
  88.        RES_AAONLY
  89.               Accept  authoritative  answers  only.   With   this
  90.               option,  _r_e_s___s_e_n_d should continue until it finds an
  91.               authoritative answer or finds an error.   Currently
  92.               this is not implemented.
  93.  
  94.        RES_USEVC
  95.               Use  TCP  connections  for  queries  instead of UDP
  96.               datagrams.
  97.  
  98.        RES_STAYOPEN
  99.               Used with RES_USEVC to keep the TCP connection open
  100.               between  queries.   This is useful only in programs
  101.               that regularly do many queries.  UDP should be  the
  102.               normal mode used.
  103.  
  104.        RES_IGNTC
  105.               Unused  currently  (ignore truncation errors, i.e.,
  106.               don't retry with TCP).
  107.  
  108.        RES_RECURSE
  109.               Set the recursion-desired bit in queries.  This  is
  110.               the  default.   (_r_e_s___s_e_n_d  does  not  do  iterative
  111.               queries and  expects  the  name  server  to  handle
  112.               recursion.)
  113.  
  114.        RES_DEFNAMES
  115.               If  set,  _r_e_s___s_e_a_r_c_h will append the default domain
  116.               name to single-component names (those that  do  not
  117.               contain a dot).  This option is enabled by default.
  118.  
  119.        RES_DNSRCH
  120.               If this option is set, _r_e_s___s_e_a_r_c_h will  search  for
  121.               host  names  in  the  current  domain and in parent
  122.               domains; see _h_o_s_t_n_a_m_e(7).   This  is  used  by  the
  123.               standard   host  lookup  routine  _g_e_t_h_o_s_t_b_y_n_a_m_e(3).
  124.               This option is enabled by default.
  125.  
  126.  
  127.  
  128.  
  129.  
  130.                         November 11, 1993                       2
  131.  
  132.  
  133.  
  134.  
  135.  
  136. RESOLVER(3)                                           RESOLVER(3)
  137.  
  138.  
  139.        RES_NOALIASES
  140.               This option turns off the user level aliasing  fea-
  141.               ture  controlled  by  the  HOSTALIASES  environment
  142.               variable.  Network daemons should set this  option.
  143.  
  144.        The _r_e_s___i_n_i_t routine reads the configuration file (if any;
  145.        see _r_e_s_o_l_v_e_r(5)) to get the default  domain  name,  search
  146.        list and the Internet address of the local name server(s).
  147.        If no server is configured, the host running the  resolver
  148.        is tried.  The current domain name is defined by the host-
  149.        name if not specified in the configuration file; it can be
  150.        overridden  by the environment variable LOCALDOMAIN.  This
  151.        environment variable may contain  several  blank-separated
  152.        tokens  if  you wish to override the _s_e_a_r_c_h _l_i_s_t on a per-
  153.        process basis.  This is similar to the _s_e_a_r_c_h  command  in
  154.        the  configuration  file.   Another  environment  variable
  155.        (``RES_OPTIONS'') can be set to override certain  internal
  156.        resolver  options  which  are  otherwise  set  by changing
  157.        fields in the ___r_e_s structure or  are  inherited  from  the
  158.        configuration  file's  _o_p_t_i_o_n_s command.  The syntax of the
  159.        ``RES_OPTIONS''  environment  variable  is  explained   in
  160.        _r_e_s_o_l_v_e_r(5).   Initialization normally occurs on the first
  161.        call to one of the other resolver routines.
  162.  
  163.        The _r_e_s___q_u_e_r_y function provides an interface to the server
  164.        query  mechanism.   It constructs a query, sends it to the
  165.        local server, awaits a  response,  and  makes  preliminary
  166.        checks  on  the  reply.  The query requests information of
  167.        the specified _t_y_p_e and  _c_l_a_s_s  for  the  specified  fully-
  168.        qualified  domain  name _d_n_a_m_e _.  The reply message is left
  169.        in the _a_n_s_w_e_r buffer with length _a_n_s_l_e_n  supplied  by  the
  170.        caller.
  171.  
  172.        The _r_e_s___s_e_a_r_c_h routine makes a query and awaits a response
  173.        like _r_e_s___q_u_e_r_y, but in addition, it implements the default
  174.        and  search  rules  controlled  by  the  RES_DEFNAMES  and
  175.        RES_DNSRCH  options.   It  returns  the  first  successful
  176.        reply.
  177.  
  178.        The  remaining  routines  are lower-level routines used by
  179.        _r_e_s___q_u_e_r_y.  The _r_e_s___m_k_q_u_e_r_y function constructs a standard
  180.        query  message  and places it in _b_u_f.  It returns the size
  181.        of the query, or -1 if the query is  larger  than  _b_u_f_l_e_n.
  182.        The  query type _o_p is usually QUERY, but can be any of the
  183.        query types defined in _<_a_r_p_a_/_n_a_m_e_s_e_r_._h_>.  The domain  name
  184.        for  the  query  is  given  by  _d_n_a_m_e.  _N_e_w_r_r is currently
  185.        unused but is intended for making update messages.
  186.  
  187.        The _r_e_s___s_e_n_d  routine  sends  a  pre-formatted  query  and
  188.        returns  an  answer.  It will call _r_e_s___i_n_i_t if RES_INIT is
  189.        not set, send the query to the local name server, and han-
  190.        dle timeouts and retries.  The length of the reply message
  191.        is returned, or -1 if there were errors.
  192.  
  193.  
  194.  
  195.  
  196.                         November 11, 1993                       3
  197.  
  198.  
  199.  
  200.  
  201.  
  202. RESOLVER(3)                                           RESOLVER(3)
  203.  
  204.  
  205.        The _d_n___c_o_m_p function compresses the domain name _e_x_p___d_n and
  206.        stores  it in _c_o_m_p___d_n.  The size of the compressed name is
  207.        returned or -1 if there were  errors.   The  size  of  the
  208.        array  pointed to by _c_o_m_p___d_n is given by _l_e_n_g_t_h.  The com-
  209.        pression uses an array of pointers _d_n_p_t_r_s  to  previously-
  210.        compressed  names  in  the  current  message.   The  first
  211.        pointer points to to the beginning of the message and  the
  212.        list  ends with NULL.  The limit to the array is specified
  213.        by _l_a_s_t_d_n_p_t_r.  A side effect of _d_n___c_o_m_p is to  update  the
  214.        list  of  pointers for labels inserted into the message as
  215.        the name is compressed.  If _d_n_p_t_r is NULL, names  are  not
  216.        compressed.   If  _l_a_s_t_d_n_p_t_r is NULL, the list of labels is
  217.        not updated.
  218.  
  219.        The _d_n___e_x_p_a_n_d entry expands  the  compressed  domain  name
  220.        _c_o_m_p___d_n  to a full domain name The compressed name is con-
  221.        tained in a query or reply message; _m_s_g is  a  pointer  to
  222.        the  beginning  of  the message.  The uncompressed name is
  223.        placed in the buffer indicated by _e_x_p___d_n which is of  size
  224.        _l_e_n_g_t_h.   The size of compressed name is returned or -1 if
  225.        there was an error.
  226.  
  227. FFIILLEESS
  228.        /etc/resolv.conf    see resolver(5)
  229.  
  230. SSEEEE AALLSSOO
  231.        gethostbyname(3), named(8), resolver(5), hostname(7),
  232.        RFC1032, RFC1033, RFC1034, RFC1035, RFC974,
  233.        SMM:11 Name Server Operations Guide for BIND
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.                         November 11, 1993                       4
  263.  
  264.  
  265.